/*
 * @Author: Clark
 * @Email: haixuanwoTxh@gmail.com
 * @Date: 2023-01-28 18:07:21
 * @LastEditors: Clark
 * @LastEditTime: 2023-01-28 18:07:31
 * @Description: file content
 */
#include <unistd.h>
#include <fcntl.h>

int lockfile(int fd)
{
    struct flock fl;
    fl.l_type = F_WRLCK;
    fl.l_start = 0;
    fl.l_whence = SEEK_SET;
    fl.l_len = 0;
    return (fcntl(fd, F_SETLK, &fl));
}
